class AssignmentAnswer < ActiveRecord::Base
  belongs_to :assignment
  belongs_to :grader, :class_name => "User", :foreign_key => "grader_id"
  belongs_to :user
  has_one :answer_blob, :dependent => :destroy

  validates_numericality_of :grade, :message => 'La calificación debe ser un numero entre 0 y 100', :if => Proc.new { |g| not g.grade.nil? and g.grade != '' }
  validates_inclusion_of :grade, :allow_nil => true, :in => 0..100, :message => 'La calificación debe estar entre 0 y 100'

end
